package com.cuit.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
//es搜索引擎
// SpringData要求我们在"实体类"中使用特定注解标记
// @Document注解标记当前类和ES关联
// indexName指定索引名称,我们这里叫items,当操作这个索引时,如果索引不存在,会自动创建
@Document(indexName = "books", type = "logs") //索引_类型
public class esbook implements Serializable {
    @Id
    private Integer id;

    @Field(type= FieldType.Text)
    private String bookname;

    @Field(type=FieldType.Text)
    private String bookimg;

    @Field(type=FieldType.Float)
    private Double bookprice;

    @Field(type=FieldType.Text)
    private String booktypename;

    @Field(type=FieldType.Text)
    private String bookdesc;
    @Field(type=FieldType.Long)
    private Long sellnum;
}
